cmake_minimum_required(VERSION 3.6)
project(test_package LANGUAGES C)

add_executable(${PROJECT_NAME} test_package.c)

if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
    find_package(glib CONFIG REQUIRED)
    target_link_libraries(${PROJECT_NAME} PRIVATE glib::glib-2.0 glib::gio-2.0 glib::gmodule-2.0 glib::gobject-2.0 glib::gthread-2.0)
else()
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(glib-2.0 REQUIRED IMPORTED_TARGET glib-2.0)
    pkg_check_modules(gio-2.0 REQUIRED IMPORTED_TARGET gio-2.0)
    pkg_check_modules(gmodule-2.0 REQUIRED IMPORTED_TARGET gmodule-2.0)
    pkg_check_modules(gobject-2.0 REQUIRED IMPORTED_TARGET gobject-2.0)
    pkg_check_modules(gthread-2.0 REQUIRED IMPORTED_TARGET gthread-2.0)
    target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0)
endif()
